#define _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    bool canConstruct(string r, string m) {
        vector<int> hash1(26);
        vector<int> hash2(26);
        for (auto e : r) hash1[e - 'a']++;
        for (auto e : m) hash2[e - 'a']++;
        for (auto e : r)
        {
            if (hash2[e - 'a'] == 0)
            {
                return false;
            }
            hash2[e - 'a']--;
        }
        return true;
    }
};